# -*- encoding: utf-8 -*-
from common.dwc.friday import marketing_cached_handler


def s2s_report_handler_v3(game_id, time_range, filtered):
    data = marketing_cached_handler.get_aggregation_data(game_id,
                                                         marketing_cached_handler.ExternalEnum.DailyS2s,
                                                         time_range=time_range,
                                                         filtered=filtered)
    if not data:
        return dict(msg="数据暂未生成，请稍后再试")
    return data


def dwc_daily_user_report_v3(game_id, time_range, filtered, interval_type):
    data = marketing_cached_handler.get_aggregation_data(game_id,
                                                         marketing_cached_handler.ExternalEnum.DailyUser,
                                                         time_range=time_range,
                                                         filtered=filtered,
                                                         interval_type=interval_type)
    if not data:
        return dict(msg="数据暂未生成，请稍后再试")
    return data


def dwc_daily_device_report_v3(game_id, time_range, filtered):
    data = marketing_cached_handler.get_aggregation_data(game_id,
                                                         marketing_cached_handler.ExternalEnum.DailyDevice,
                                                         time_range=time_range,
                                                         filtered=filtered)
    if not data:
        return dict(msg="数据暂未生成，请稍后再试")
    return data


def dwc_summary_report_v3(app_name, time_range):
    data = marketing_cached_handler.get_aggregation_data(app_name,
                                                         marketing_cached_handler.ExternalEnum.DailySummary,
                                                         time_range=time_range)
    if not data:
        return dict(msg="数据暂未生成，请稍后再试")
    return data
